package net.lwf.entity;

import net.lwf.common.constant.ICommonConstant;
import net.lwf.web.constant.IWebConstant;

/**
 * Type the class description here
 *  
 */
public class UserPreferences {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String name;
	private String level = IWebConstant.NOT_PRE_SCHOOL;
	private String javaScriptFile = null;
	private int attempts = 3;
	private String seeAnswer = ICommonConstant.YES;
	private boolean isPreK = false;
	
	

	/**
	 * @return Returns the isPreK.
	 */
	public boolean isPreK() {
		return isPreK;
	}
	/**
	 * @return Returns the level.
	 */
	public String getLevel() {
		return level;
	}
	/**
	 * @param level The level to set.
	 */
	public void setLevel(String level) {
		if(level != null && level.equals(IWebConstant.PRE_SCHOOL)) {
			this.javaScriptFile = "preschool_menuscript.js";
			this.isPreK = true;
		}
		else {
			javaScriptFile = "menuscript.js";
			this.isPreK = false;
		}
		this.level = level;
	}
	
	
	
	/**
	 * @return Returns the javaScriptFile.
	 */
	public String getJavaScriptFile() {
		
		if(level != null && level.equals(IWebConstant.PRE_SCHOOL)) {
			this.javaScriptFile = "preschool_menuscript.js";
			this.isPreK = true;
		}
		else {
			javaScriptFile = "menuscript.js";
			this.isPreK = false;
		}

		
		return javaScriptFile;
	}
	/**
	 * @return Returns the attempts.
	 */
	public int getAttempts() {
		return attempts;
	}
	/**
	 * @param attempts The attempts to set.
	 */
	public void setAttempts(int attempts) {
		this.attempts = attempts;
	}
	/**
	 * @return Returns the name.
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name The name to set.
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * @return Returns the seeAnswer.
	 */
	public String getSeeAnswer() {
		return seeAnswer;
	}
	/**
	 * @param seeAnswer The seeAnswer to set.
	 */
	public void setSeeAnswer(String seeAnswer) {
		this.seeAnswer = seeAnswer;
	}
	
	public boolean hasData() {
		if(getName() != null && getName().trim().length() != 0 && 
		   getSeeAnswer() != null &&
		   getAttempts() != 0) {
			return true;
		}
		return false;
	}
	
	public boolean hasPreKPref() {
		if (getName() != null && getName().trim().length() != 0
				&& getSeeAnswer() != null) {
			return true;
		}
		return false;
	
	}
}
